//package com.imedway.ihe.service;
//
//import java.net.URL;
//import java.util.List;
//
//import javax.jws.WebMethod;
//import javax.jws.WebParam;
//import javax.jws.WebService;
//import javax.xml.namespace.QName;
//import javax.xml.ws.BindingType;
//import javax.xml.ws.soap.Addressing;
//import javax.xml.ws.soap.MTOM;
//import javax.xml.ws.soap.SOAPBinding;
//
//import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.ProvideAndRegisterDocumentSetRequestType;
//import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest;
//import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryError;
//import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryErrorList;
//import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryResponseType;
//import org.openehealth.ipf.commons.ihe.xds.iti41.Iti41PortType;
//import org.openehealth.ipf.commons.ihe.xds.iti42.Iti42PortType;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import com.imedway.ihe.dtz.xds.repository.camel.Iti41Repository_CAMEL;
//import com.imedway.ihe.dtz.xds.util.JaxbMapperUtils;
//
//import lombok.extern.slf4j.Slf4j;
///**
// * @author dtz<br/>
// * @date 2024/7/3
// */
//@Slf4j
//@MTOM
//@WebService
//@Service
//@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
//@Addressing(required = true)
//public class Iti41PortTypeImpl implements Iti41PortType {
//	
//	@Autowired
//	private Iti41Repository_CAMEL iti41Repository_CAMEL;
//
//	@WebMethod
//	@Override
//	public RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB(
//			@WebParam ProvideAndRegisterDocumentSetRequestType body) {
//		log.debug("-------Iti41PortTypeImpl.documentRepositoryProvideAndRegisterDocumentSetB-------");
//		log.debug(JaxbMapperUtils.convertToXml(body, "UTF-8", true));
//		RegistryResponseType registryResponseType=new RegistryResponseType();
////		Iti41Repository iti41Repository = new Iti41Repository();
//		registryResponseType = iti41Repository_CAMEL.run(body);
////		if("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success".equals(registryResponseType.getStatus())) {		
//		RegistryResponseType registry42ResponseType =iti42Regitry(body.getSubmitObjectsRequest());
//		RegistryErrorList registryErrorList =registry42ResponseType.getRegistryErrorList();
//		if(registryErrorList!=null) {
//			RegistryErrorList registry41ErrorList = registryResponseType.getRegistryErrorList();
//			List<RegistryError> registry41Errors = registry41ErrorList.getRegistryError();
//			List<RegistryError> registryErrors = registryErrorList.getRegistryError();
//			for(RegistryError reError:registryErrors) {
//				registry41Errors.add(reError);
//			}
//			registryResponseType.setRegistryErrorList(registry41ErrorList);
//		}
//		
////		};
//		log.debug(JaxbMapperUtils.convertToXml(registryResponseType, "UTF-8", true));
//		return registryResponseType;
//	}
//
//	private RegistryResponseType  iti42Regitry(SubmitObjectsRequest submitObjectsRequest) {
//		URL wsdlUrl;
//		RegistryResponseType registryResponseType = new RegistryResponseType();
//		try {
//			wsdlUrl = new URL("http://localhost:8080/services/iti42?wsdl");
//			QName serviceName = new QName("http://service.ihe.imedway.com/", "Iti42PortTypeImplService");
//			javax.xml.ws.Service service = javax.xml.ws.Service.create(wsdlUrl, serviceName);
//			Iti42PortType myWebService = service.getPort(Iti42PortType.class);
//			registryResponseType=myWebService.documentRegistryRegisterDocumentSetB(submitObjectsRequest);
//		} catch (Exception e) {
//			log.debug(e.getMessage(), e);
//		}
//		return registryResponseType;
//	}
//	
//}
